package com.ruoyi.system.api.factory;

import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteSysDeptService;
import com.ruoyi.system.api.domain.SysDept;

/**
 * 部门微服务降级处理
 * 
 * @author ruoyi
 * @date 2023-04-27
 */
@Component
public class RemoteSysDeptFallbackFactory implements FallbackFactory<RemoteSysDeptService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteSysDeptFallbackFactory.class);

    @Override
    public RemoteSysDeptService create(Throwable throwable)
    {
        log.error("部门服务调用失败:" + throwable.getMessage(), throwable);
        return new RemoteSysDeptService()
        {
            @Override
            public R<SysDept> selectSysDeptByDeptId(Long deptId, String source) {
                return null;
            }

            @Override
            public R<List<SysDept>> selectSysDeptList(SysDept sysDept, String source) {
                return null;
            }

            @Override
            public R<Integer> insertSysDept(SysDept sysDept, String source) {
                return null;
            }

            @Override
            public R<Integer> updateSysDept(SysDept sysDept, String source) {
                return null;
            }

            @Override
            public R<Integer> deleteSysDeptByDeptIds(Long[] deptIds, String source) {
                return null;
            }
        };

    }
}
